Fill in defaults for omitted parameters to RecentChange::sendToUDP
authorOri Livneh <ori@wikimedia.org>
Thu, 29 Aug 2013 20:24:35 +0000 (13:24 -0700)
committerOri Livneh <ori@wikimedia.org>
Thu, 29 Aug 2013 20:36:32 +0000 (13:36 -0700)
Not all callers of RecentChange::sendToUDP pass all the parameters -- which is
to be expected, since the sendToUDP's signature specifies the empty string as
default. It is not correct to leave the values empty, though, since they are
used to construct the logging URL. When the parameters are unset, the correct
behavior should be to fill in defaults from $wgRC2UDP*, as was the case prior
to I270bde418. This patch reverts to the old, correct behavior.

Change-Id: I4570473ae7382e602292e58a41e440325a65a275

includes/RecentChange.php

index 45a8fbc..9854a85 100644 (file)
@@ -297,12 +297,18 @@ class RecentChange {
         * @deprecated since 1.22
         */
        public static function sendToUDP( $line, $address = '', $prefix = '', $port = '' ) {
-               global $wgRC2UDPPrefix, $wgRC2UDPInterwikiPrefix;
+               global $wgRC2UDPAddress, $wgRC2UDPInterwikiPrefix, $wgRC2UDPPort, $wgRC2UDPPrefix;
+
                wfDeprecated( __METHOD__, '1.22' );
 
+               # Assume default for standard RC case
+               $address = $address ? $address : $wgRC2UDPAddress;
+               $prefix = $prefix ? $prefix : $wgRC2UDPPrefix;
+               $port = $port ? $port : $wgRC2UDPPort;
+
                $engine = new UDPRCFeedEngine();
                $feed = array(
-                       'uri' => "udp://$address:$port/$wgRC2UDPPrefix",
+                       'uri' => "udp://$address:$port/$prefix",
                        'formatter' => 'IRCColourfulRCFeedFormatter',
                        'add_interwiki_prefix' => $wgRC2UDPInterwikiPrefix,
                );